<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sj" tagdir="/WEB-INF/tags/spring-jquery-tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<script type="text/javascript" src="<c:url value='/js/jquery/jquery.numeric.js'/>"></script>
<script type="text/javascript" src="<c:url value='/js/jquery/jquery.formatCurrency-1.4.0.pack.js'/>"></script>
<script type="text/javascript">
	$(document).ready(function() {
		<c:choose>
			<c:when test="${cipeproject.id !=null and cipeproject.id gt 0}">
				$('#pageTitle').text('<spring:message code="editCipeproject.heading.view" />');
			</c:when>
			<c:otherwise>
				$('#pageTitle').text('<spring:message code="editCipeproject.heading" />');
			</c:otherwise>
		</c:choose>	
			
		$.validator.addMethod("endDateValidation", function(value, element) {
			var date_ini = new Date($('#projectStartDate').val()).getTime();
			var date_end = new Date($('#projectEndDate').val()).getTime();
			if (isNaN(date_ini)) {
				//if required we will add code
			} else if (isNaN(date_end)) {
				//if required we will add code
			} else if (date_ini > date_end) {
				return false;

			}
			return true;
		},  "Project End Date must be greater than the Project Start Date."
		);

		$.validator.addMethod("startDateValidation", function(value, element) {
			var date_ini = new Date($('#projectStartDate').val()).getTime();
			var date_end = new Date($('#projectEndDate').val()).getTime();
			if (isNaN(date_ini)) {
			} else if (isNaN(date_end)) {
			} else if (date_ini > date_end) {
				return false;

			}
			return true;
		},  "Project Start Date must be less than the Project End Date."
		);
		
		$.validator.addMethod("startDateValidateDonorAward",function(value,element){
		  	var date_ini = new Date($('#projectStartDate').val()).getTime();
			var date_end = new Date($('#donorStartDate').val()).getTime();
			if (isNaN(date_ini)) {
			} else if (isNaN(date_end)) {
			} else if (date_ini < date_end) {
				return false;
			}
			return true;
		 },
		  "Project Start Date must be greater than or equal to the Donor Award Start Date."
		 );
		
		$.validator.addMethod("endDateValidateDonorAward",function(value,element){
		  	var date_ini = new Date($('#projectEndDate').val()).getTime();
			var date_end = new Date($('#donorEndDate').val()).getTime();
			if (isNaN(date_ini)) {
			} else if (isNaN(date_end)) {
			} else if (date_ini > date_end) {
				return false;
			}
			return true;
		 },
		  "Project End Date must be less than or equal to Donor Award End Date."
		 );

		$.validator.addMethod("startDateDonorEndDateValidateDonorAward",function(value,element){
		  	var date_ini = new Date($('#projectStartDate').val()).getTime();
			var date_end = new Date($('#donorEndDate').val()).getTime();
			if (isNaN(date_ini)) {
			} else if (isNaN(date_end)) {
			} else if (date_ini > date_end) {
				return false;
			}
			return true;
		 },
		  "Project Start Date must be less than or equal to the Donor Award End Date."
		 );

		$.validator.addMethod("endDateDonorStartDateValidateDonorAward",function(value,element){
		  	var date_ini = new Date($('#projectEndDate').val()).getTime();
			var date_end = new Date($('#donorStartDate').val()).getTime();
			if (isNaN(date_ini)) {
			} else if (isNaN(date_end)) {
			} else if (date_ini < date_end) {
				return false;
			}
			return true;
		 },
		  "Project End Date must be greater than or equal to the Donor Award Start Date."
		 );
		 
		$.validator.addMethod("validateCostCenterNumber",function(value,element){
		  	var ccval = $('#costCenterNumber').val();
		  	var length = ccval.length;
		  	var re7digit=/^\d{7}$/
		  	var re3digit=/^\d{3}$/
		  					
			if (length!=12) {
				return false;
			}
			if(ccval.charAt(7)!='-')
			 {
			   return false;
			 }
			 if(ccval.charAt(11)!='-')
			 {
			   return false;
			 }
			/// alert(ccval.substring(0,7) +" " +ccval.substring(8,11));
			 if(ccval.substring(0,7).search(re7digit)==-1){
			  return false
			 }
			 if(ccval.substring(8,11).search(re3digit)==-1){
			  return false
			 }
			return true;
		 },
		 
		  "Please Enter Valid cost center number. i.e XXXXXXX-XXX-"
		 );
		 
	
		$("#editCipeprojectForm").validate({
			rules : {
				'partner.id' : {
					required : true
				},
				acronym : {
					required : true
					
				},
				costCenterNumber : {
					required : true,
					validateCostCenterNumber:true
				},
				projectTitle : {
					required : true
				},
				// TO DO it was not visible as required field in frontend
				'donoraward.id' : {
					required : true
				},
				projectStartDate : {
					required : true,
					startDateValidation : true,
					startDateValidateDonorAward : true,
					startDateDonorEndDateValidateDonorAward : true
				},
				
				projectEndDate : {
					required : true,
					endDateValidation : true,
					endDateValidateDonorAward : true,
					endDateDonorStartDateValidateDonorAward : true
				},
				'cipeprojecttype.id' : {
					required : true
				},
				'cipeprojectstatus.id' : {
					required : true
				},
				'region.id' : {
					required : true
				},
				'country.id' : {
					required : true
				},
				'seniorProgramOfficer.id' : {
					required : true
				},
				'programOfficer.id' : {
					required : true
				},
				'programAssistant.id' : {
					required : true
				},
				managementFunds : {
					required : true
				},
				fiscalYear : {
					required : true
				}
			},
		});
		$(document).ready(sortDropDownListByText);

		$("#regions").bind("change", function() {
			loadDataViaAjax("loadCountries.do", {
				"regionId" : this.value
			}, parseCountriesJson);
		});

		$("#projectStartDate").bind("change", getFiscalYear).trigger("change");
		$("#projectStartDate").bind("change", getStatus).trigger("change");
		$("#projectStartDate").bind("change", enableProjectEndDatefn).trigger("change");
		$("#creationDate").val($.format.date($("#creationDate").val(), "MM/dd/yyyy"));
           
		$("#updationDate").val($.format.date($("#updationDate").val(), "MM/dd/yyyy"));
      
      //  $('#costCenterNumber').bind('focus', function() {
			//alert(this.value);
		//	if(this.value=='XXXXXXX-XXX-'){
		//	  this.value="";
		//	  } else if($.trim(this.value)=='') {
		//	   this.value = "XXXXXXX-XXX-";
		//	  }
		// } ); 
        
         $('#costCenterNumber').bind('focusout', function() {
			//alert(this.value);
		//	 if($.trim(this.value)=='') {
		//	   this.value = "XXXXXXX-XXX-";
		//	  }
			  
			document.getElementById("projectID").value = this.value + "00";  
		 } ); 
        
		$('#donorawardId').change(function() {
			if (this.value != '') {
				loadDataViaAjax("getDonorAwardBean.do", {
					"donorawardId" : this.value
				}, function(bean) {
					$('#donorName').val(bean.donorName);
					$('#donorStartDate').val(bean.formattedStartDate);
					$('#donorEndDate').val(bean.formattedEndDate);
					$('#donorFiscalYear').val(bean.donorFiscalYear);
					//$('#donorDirectFunds').val(bean.donorDirectFunds);
					//$('#donorDirectFunds').formatCurrency('#donorDirectFundsLabel');
				});
			} else {
				$('#donorName').val('');
				$('#donorStartDate').val('');
				$('#donorEndDate').val('');
				$('#donorFiscalYear').val('');
				//$('#donorDirectFunds').val('');
			}
			;
		});
		$('#donorawardId').change();

		$('#cancelButton').click(function() {
				var ans = confirm('Are you sure you want to cancel editing this record without saving it?');
				if (ans) {
					location.href = '../secure/showDashboard.do';
				}
		});

		$('#editButton').click(function() {
			var inputs = $('#editCipeprojectForm :input');
			var selects = $('#editCipeprojectForm select');
			var checkboxes = $('#editCipeprojectForm checkbox');

			inputs.each(function() {
				$(this).removeAttr('readonly');
				$(this).removeAttr('disabled');
			});
			selects.each(function() {
				$(this).removeAttr('readonly');
				$(this).removeAttr('disabled');
			});
			checkboxes.each(function() {
				$(this).removeAttr('readonly');
				$(this).removeAttr('disabled');
			});
			$("#projectID").attr("readonly","readonly");
		});

		$("#countries").bind("change", function() {		  
			loadDataViaAjax("loadCountryUsers.do", {
				"countryId" : this.value
			}, function(result) {
				$("#programOfficer").get(0).value = result.programOfficer ? result.programOfficer : "";
				$("#programAssistant").get(0).value = result.programAssistant ? result.programAssistant : "";
			});
		});
		
		$('#programAssistant').bind("focusout",function(){		
		   $('#managementFundsLabel').click();
		});
		
		$('#managementFunds').numeric();

		/*
		$('#managementFunds').blur(function() {
		    var strV = $('#managementFunds').val();
		   //  alert(strV.substring(0,strV.indexOf('.')) );
		   if(strV.indexOf('.')!=-1){
		    	strV = strV.substring(0,strV.indexOf('.')) ;
		    	$('#managementFunds').val( strV);
		    }
		    		   
			$('#managementFunds').formatCurrency('#managementFundsLabel',{colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: 0});
		   	 // var errorMsg = 'Please do not enter any cents (0.' + cents + ')';
			 // $('#warnOnDecimalsEnteredNotification2').html(errorMsg);
			showSubstitute(true, 'managementFundsLabel','managementFunds');
		});
		$('#managementFundsLabel').click(function() {
			showSubstitute(false, 'managementFundsLabel','managementFunds');	
		});
		showSubstitute(true, 'managementFundsLabel','managementFunds');
		*/
	});
	
	function showSubstitute(show, subId, tobeSubId) {
		if(show) {
			$('#' + subId).css('display', 'block');
			$('#' + tobeSubId).css('display', 'none');
		} else {
			$('#' + subId).css('display', 'none');
			$('#' + tobeSubId).css('display', 'block');
			$('#' + tobeSubId).focus();
		}
	}
    
	function parseCountriesJson(data) {
		var html = "<option value=''>Select</option>";
		var directorId = "";
		if (data) {
			for (p in data) {
				if (p != 'director') {
					html += "<option value='" + p + "'>" + data[p] + "</option>";
				} else {
					directorId = data[p];
				}
			}
		}
		$("#countries option").remove();
		$("#countries").append(html).trigger("change");
		$("#seniorProgramOfficer").get(0).value = directorId;
		sortDropDownListByText();
	}
	
   /**
	$(function() {
		$("#regions").trigger("change");
	});
	
	$(function() {
		$("#countries").trigger("change");
	});
	*/
	var pickerOpts = {
		onClose : function() {
			this.focus();
		}
	};
	$(function() {
		$("#projectStartDate").datepicker(pickerOpts);
	});
	$(function() {
		$("#projectEndDate").datepicker(pickerOpts);
	});
	$('#add-partner').click(function() {
		loadDiv('content', 'showAddPartner.do?fromProject=true');
	});

	$('#add-partnergrant').click(function() {
		loadDiv('content', 'showAddPartnergrantWithProject.do?cipeprojectId=' + $(this).attr('cipeprojectId'));
	});
	
	$('#edit-donoraward').click(function() {
		var sel = document.getElementById("donorawardId");
		var idVal = sel.options[sel.selectedIndex].value;
		if (idVal != 0) {
			loadDiv('content', 'showEditDonoraward.do?id=' + idVal);
		}
	});
		$('.close-button').click(function() {
			if (confirm('Are you sure you want to close the form?')) {
				window.location = '../secure/showDashboard.do';
			}
		});
	function getFiscalYear() {

		var str1 = document.getElementById("projectStartDate").value;

		var mon1 = parseInt(str1.substring(0, 2), 10);
		var dt1 = parseInt(str1.substring(3, 5), 10);
		var yr1 = parseInt(str1.substring(6, 10), 10);
		var dt2 = 1;
		var mon2 = 10;

		var date1 = new Date(yr1, mon1, dt1);
		var date2 = new Date(yr1, mon2, dt2);

		if (isNaN(yr1)) {
			//do nothing
		} else {

			if (date1 >= date2) {
				document.getElementById("fiscalYear").value = yr1 + 1;
			} else {
				document.getElementById("fiscalYear").value = parseInt(yr1);
			}
		}
	}

	
	function getStatus() {
		var str1 = document.getElementById("projectStartDate").value;
		var mon1 = parseInt(str1.substring(0, 2), 10) - 1;//Number of month (0-11)
		var dt1 = parseInt(str1.substring(3, 5), 10);
		var yr1 = parseInt(str1.substring(6, 10), 10);
		var today = new Date();
		var date1 = new Date(yr1, mon1, dt1);
		if (date1 > today) {
			$("#status").val("5");//set status to Pending
		} else {
			$("#status").val("1");//set status to Active

		}
	}
	function sortDropDownListByText() {
		// Loop for each select element on the page.

		$("select").each(function() {

			// Keep track of the selected option.
			var selectedValue = $(this).val();
			// Sort all the options by text.
			$(this).html($("option", $(this)).sort(function(a, b) {

				return a.text == b.text ? 0 : ((a.text < b.text) || (a.value == '')) ? -1 : 1;
				// return a.text == $(selectId + 'option:first').text ? -1 : a.text < b.text ? -1 : 1;
			}));

			// Select one option.
			$(this).val(selectedValue);
		});
	}

	function enableProjectEndDatefn() {

		if ($("#projectStartDate").val() == "") {
			//do nothing
		} else {

			$("#projectEndDate").removeAttr('readonly');
			$("#projectEndDate").removeAttr('disabled');
		}
	}
	
	$("#projectEndDate").change(function() {
		var date_ini = new Date($('#projectStartDate').val()).getTime();
		var date_end = new Date($('#projectEndDate').val()).getTime();
		if (isNaN(date_ini)) {
			//if required we will add code
		} else if (isNaN(date_end)) {
			//if required we will add code
		} else if (date_ini > date_end) {

			//alert("The Project End date must be after Project Start Date");

		}

	});
</script>
<div id="editCipeprojectDiv">
	<form:form name="editCipeprojectForm" id="editCipeprojectForm" action="saveCipeproject.do" method="post" modelAttribute="cipeproject">
		<form:hidden path="id" />
		<div class="main_form">
			<div class="form_head">
				<div class="floatL" style="padding-top: 5px;">
					<c:choose>
						<c:when test="${cipeproject.id !=null and cipeproject.id gt 0}">
							<a href="#" id="add-partnergrant" class="blue_btn" cipeprojectId="${cipeproject.id}" tabindex="-1"><spring:message code="editCipeproject.link.addParntergrant" /></a>
						</c:when>
						<c:otherwise>
						</c:otherwise>
					</c:choose>
				</div>
				<a href="#" class="close-button gray_btn floatR" tabindex="-1">Close Form</a><br class="clear" />
			</div>
			<div class="form_cont">
				<table cellspacing="5" width="100%">
					<tr class="row">
						<td class="input-field" colspan="5"><%@ include file="/common/messages.jsp"%></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.type" /></td>
						<td class="input-field"><form:select path="cipeprojecttype.id" cssClass="input-full-width-req text_blue" tabindex="1">
								<form:option value="" label="Select" />
								<form:options items="${cipeprojecttypeList}" itemValue="id" itemLabel="displayName" />
							</form:select> <form:errors path="cipeprojecttype.id" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="editCipeproject.label.seniorProgramOfficer" /></td>
						<td class="input-field"><form:select id="seniorProgramOfficer" path="seniorProgramOfficer.id" cssClass="input-full-width-req text_blue" tabindex="18">
								<form:option value="" label="Select" />
								<form:options items="${seniorProgramOfficerList}" itemValue="id" itemLabel="fullName" />
							</form:select> <form:errors path="seniorProgramOfficer.id" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.costCenter" /></td>
						<td class="input-field"><form:input path="costCenterNumber" id="costCenterNumber" cssClass="input-full-width-req text_blue" tabindex="2" /> <form:errors path="costCenterNumber" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="editCipeproject.label.programOfficer" /></td>
						<td class="input-field"><form:select id="programOfficer" path="programOfficer.id" cssClass="input-full-width-req text_blue" tabindex="19">
								<form:option value="" label="Select" />
								<form:options items="${programOfficerList}" itemValue="id" itemLabel="fullName" />
							</form:select> <form:errors path="programOfficer.id" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.projectID" /></td>
						<td class="input-field"><c:choose>
								<c:when test="${cipeproject.id !=null and cipeproject.id gt 0}">
									<form:input path="projectID" readonly="true" cssClass="input-full-width text_grey" tabindex="3" />
								</c:when>
								<c:otherwise>
									<form:input path="projectID" value="-00" readonly="true" cssClass="input-full-width text_grey" tabindex="3" />
								</c:otherwise>
							</c:choose> <form:errors path="projectID" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="editCipeproject.label.programAssistant" /></td>
						<td class="input-field"><form:select id="programAssistant" path="programAssistant.id" cssClass="input-full-width-req text_blue" tabindex="20">
								<form:option value="" label="Select" />
								<form:options items="${programAssistantList}" itemValue="id" itemLabel="fullName" />
							</form:select> <form:errors path="programAssistant.id" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.partner" /></td>
						<td class="input-field" nowrap="nowrap"><form:select path="partner.id" cssClass="input-full-width-req text_blue" tabindex="4">
								<form:option value="" label="Select" />
								<form:options items="${partnerList}" itemValue="id" itemLabel="partnerName" style="word-wrap:break-word;width:410px;" />
							</form:select> <input type="button" id="add-partner" class="blue_btn" value="<spring:message code="link.add" />" cipeprojectId="${cipeproject.id}" tabindex="-1" /> <form:errors path="partner.id" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="editCipeproject.label.managementFunds" /></td>
						<td class="input-field"><form:input path="managementFunds" cssClass="input-full-width-req text_blue" tabindex="21" /> <%-- <div id="managementFundsLabel" class="input-sub input-full-width-req text_blue">&nbsp;</div>--%> <form:errors
								path="managementFunds" cssClass="error"
							/></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.donorAwardID" /></td>
						<td class="input-field" nowrap="nowrap"><form:select id="donorawardId" path="donoraward.id" cssClass="input-full-width-req text_blue" tabindex="6">
								<form:option value="" label="Select" />
								<form:options items="${donorawardList}" itemValue="id" itemLabel="fullDonorawardNumber" />
							</form:select> <input type="button" class="blue_btn" id="edit-donoraward" value="<spring:message code="link.view" />" tabindex="-1" /> <form:errors path="donoraward.id" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="editCipeproject.label.nedIdentifier" /></td>
						<td class="input-field"><form:input path="nedIdentifier" cssClass="input-full-width text_white" tabindex="22" /> <form:errors path="nedIdentifier" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.donorName" /></td>
						<td class="input-field"><form:input path="" readonly="true" cssClass="input-full-width text_grey" id="donorName" tabindex="-1" /> <form:errors path="" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="editCipeproject.label.rollup" /></td>
						<td class="input-field"><form:select path="masterProject.id" cssClass="text_white" tabindex="23">
								<form:option value="" label="Select" />
								<form:options items="${cipeprojectrollupList}" itemValue="id" itemLabel="projectTitle" />
							</form:select> <form:errors path="masterProject.id" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.donorStartDate" /></td>
						<td class="input-field"><form:input path="" readonly="true" cssClass="input-full-width text_grey" id="donorStartDate" tabindex="-1" /> <form:errors path="" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="editCipeproject.label.fiscalYear" /></td>
						<td class="input-field"><form:input path="fiscalYear" cssClass="input-full-width text_blue" tabindex="24" /> <form:errors path="fiscalYear" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.donorEndDate" /></td>
						<td class="input-field"><form:input path="" readonly="true" cssClass="input-full-width text_grey" id="donorEndDate" tabindex="-1" /> <form:errors path="" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="editCipeproject.label.memo" /></td>
						<td class="input-field"><form:input path="memo" cssClass="input-full-width text_white" tabindex="25" /> <form:errors path="memo" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.startDate" /></td>
						<td class="input-field"><form:input path="projectStartDate" cssClass="input-full-width-req text_blue" tabindex="11" /> <form:errors path="projectStartDate" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="editCipeproject.label.fileLocation" /></td>
						<td class="input-field"><form:input path="fileLocation" cssClass="input-full-width text_white" tabindex="26" /> <form:errors path="fileLocation" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.endDate" /></td>
						<td class="input-field"><form:input path="projectEndDate" cssClass="input-full-width-req text_blue" tabindex="12" /> <form:errors path="projectEndDate" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="editCipeproject.label.blockTimeSheet" /></td>
						<td class="input-field"><form:checkbox path="blockTimeSheet" cssClass="input-full-width" value="true" tabindex="27" /> <form:errors path="blockTimeSheet" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.acronym" /></td>
						<td class="input-field"><form:input path="acronym" cssClass="input-full-width-req text_blue" tabindex="13" /> <form:errors path="acronym" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="editCipeproject.label.override" /></td>
						<td class="input-field"><form:checkbox path="override" cssClass="input-full-width" value="true" tabindex="28" /> <form:errors path="override" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.projectTitle" /></td>
						<td class="input-field"><form:input path="projectTitle" cssClass="input-full-width-req text_blue" tabindex="14" /> <form:errors path="projectTitle" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="label.createdBy" /></td>
						<td class="input-field"><form:input readonly="true" path="createdBy.fullName" cssClass="input-full-width text_grey" tabindex="-1" /> <form:errors path="createdBy" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.region" /></td>
						<td class="input-field"><form:select path="region.id" cssClass="input-full-width-req text_blue" id="regions" tabindex="15">
								<form:option value="" label="Select" />
								<form:options items="${regionList}" itemValue="id" itemLabel="displayName" />
							</form:select> <form:errors path="region.id" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="label.creationDate" /></td>
						<td class="input-field"><form:input readonly="true" path="creationDate" cssClass="input-full-width text_grey" tabindex="-1" /> <form:errors path="creationDate" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.country" /></td>
						<td class="input-field"><form:select path="country.id" id="countries" cssClass="input-full-width-req text_blue" tabindex="16">
								<form:option value="" label="Select" />
								<form:options items="${countryList}" itemValue="id" itemLabel="displayName" />
							</form:select> <form:errors path="country.id" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="label.updatedBy" /></td>
						<td class="input-field"><form:input readonly="true" path="updatedBy.fullName" cssClass="input-full-width text_grey" tabindex="-1" /> <form:errors path="updatedBy" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="label"><spring:message code="editCipeproject.label.status" /></td>
						<td class="input-field"><form:select path="cipeprojectstatus.id" cssClass="input-full-width-req text_blue" id="status" tabindex="17">
								<c:choose>
									<c:when test="${cipeproject.id !=null and cipeproject.id gt 0}">
										<form:option value="" label="Select" />
										<form:options items="${cipeprojectstatusList}" itemValue="id" itemLabel="id" />
									</c:when>
									<c:otherwise>
										<form:option value="1" label="Active" />
										<form:option value="5" label="Pending" />
									</c:otherwise>
								</c:choose>
							</form:select> <form:errors path="cipeprojecttype.id" cssClass="error" /></td>
						<td width="50">&nbsp;</td>
						<td class="label"><spring:message code="label.updationDate" /></td>
						<td class="input-field"><form:input readonly="true" path="updationDate" cssClass="input-full-width text_grey" tabindex="-1" /> <form:errors path="updationDate" cssClass="error" /></td>
					</tr>
					<tr class="row">
						<td class="input-field" colspan="5" style="text-align: center;"><c:choose>
								<c:when test="${cipeproject.id !=null and cipeproject.id gt 0}">
									<input id="editButton" class="blue_btn" type="button" value="Edit" tabindex="33" />
									<input id="cancelButton" class="blue_btn" type="reset" value="<spring:message code='button.cancel' />" tabindex="34" />
									<sj:submit id="loginFormSubmit" cssClass="blue_btn" target="editCipeprojectDiv" key="editCipeproject.button.save" validate="true" tabindex="35" />
								</c:when>
								<c:otherwise>
									<input id="cancelButton" class="blue_btn" type="reset" value="<spring:message code='button.cancel' />" tabindex="33" />
									<sj:submit id="loginFormSubmit" cssClass="blue_btn" target="editCipeprojectDiv" key="editCipeproject.button.save" validate="true" tabindex="34" />
								</c:otherwise>
							</c:choose></td>
					</tr>
				</table>
				<br class="clear" />
				<table class="tablesorter">
					<thead>
						<tr>
							<th>ID</th>
							<th>Modification Type</th>
							<th>Modified From</th>
							<th>Modified To</th>
							<th>Modified Date</th>
							<th>Modified By</th>
							<th>File Location of Modified Document</th>
						</tr>
					</thead>
					<tbody>
						<c:choose>
							<c:when test="${fn:length(cipeproject.cipeprojectmodifications) > 0}">
								<c:forEach items="${cipeproject.cipeprojectmodifications}" var="modification">
									<tr>
										<td>${modification.id}</td>
										<td>${modification.modificationType.modificationTypeDesc}</td>
										<td>${modification.modifiedFrom}</td>
										<td>${modification.modifiedTo}</td>
										<td>${modification.formattedModifiedDate}</td>
										<td>${modification.modifiedBy.fullName}</td>
										<td>${modification.attachment}</td>
									</tr>
								</c:forEach>
							</c:when>
							<c:otherwise>
								<tr>
									<td colspan="7" style="padding-left: 10px;">No modifications found.</td>
								</tr>
							</c:otherwise>
						</c:choose>
					</tbody>
				</table>
			</div>
		</div>
	</form:form>
</div>